博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wpgcms---详情页面数据怎么渲染
阅读量:6880 次
发布时间:2019-06-27

本文共 2055 字,大约阅读时间需要 6 分钟。

wpgcms的详情页面的数据会被保存在 contentInfo 这么一个字段里面。

面包屑导航调用:

当前位置 {

% for c in crumb|slice(1, crumb|length-1) %} {
% if not loop.last %}> {
{ c.name }}
{
% else %}> 新闻详情 {
% endif %}{
% endfor %}

标题,正文,时间的调用:

{
{ contentInfo.title }}

{% autoescape false %} {
{ contentInfo.getBodyInfo() }} {% endautoescape %}
{% set pubtime = contentInfo.publish_time %} 时间:{
{ pubtime|slice(0, 4) }}年{
{ pubtime|slice(5, 2) }}月{
{ pubtime|slice(8, 2) }}日
来源:{
{ contentInfo.source_name|default('金塔集团') }}
阅读:{
{ contentInfo.view_count }}

下一篇,下一篇的调用:

{% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} 下一篇:{

{ nextInfo.title }} {% endif %}

完整实例:

{% extends 'layout.html' %}{% block pageContent %}

当前位置 {% for c in crumb|slice(1, crumb|length-1) %} {% if not loop.last %}> {

{ c.name }} {% else %}> 新闻详情 {% endif %} {% endfor %}

{
{ contentInfo.title }}

{% autoescape false %} {
{ contentInfo.getBodyInfo() }} {% endautoescape %}
{% set pubtime = contentInfo.publish_time %} 时间:{ { pubtime|slice(0, 4) }}年{ { pubtime|slice(5, 2) }}月{ { pubtime|slice(8, 2) }}日 来源:{ { contentInfo.source_name|default('金塔集团') }} 阅读:{ { contentInfo.view_count }}

{% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} 下一篇:{

{ nextInfo.title }} {% endif %}

{% endblock %}

 

转载于:https://www.cnblogs.com/e0yu/p/9928409.html

你可能感兴趣的文章
service 需要注意的地方
查看>>
【并查集】Gym - 101128B - Black Vienna
查看>>
【模拟】洛谷 P1328 NOIP2014提高组 day1 T1 生活大爆炸版石头剪刀布
查看>>
JavaScript中的forEach
查看>>
【BZOJ】3039: 玉蟾宫 悬线法
查看>>
Clash Detection
查看>>
从CAP理论中分析Eureka与zookeeper的区别
查看>>
20172318 2018-2019-1 《程序设计与数据结构》第2周学习总结
查看>>
文件操作
查看>>
ubuntu忘记root密码解决
查看>>
windows 80端口被占用的解决方法
查看>>
Qt学习五 - 对话框
查看>>
Android 学习 笔记_12. Spinner的简单实使用
查看>>
手册与参考链接
查看>>
做错的题目——this的指向
查看>>
Struts、JSTL标签库的基本使用方法
查看>>
A Tour of Go Numeric Constants
查看>>
android获取硬件信息
查看>>
计算机操作系统的因果
查看>>
C#中int,string,char[],char的转换(待续)
查看>>